package com.lanxin.oa.fiancial.controller;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.lanxin.oa.fiancial.service.BxInformalTjService;
import com.lanxin.util.PieVo;
import com.lanxin.util.TimeConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("bxtj")
public class BxInformalTjController extends TimeConverter {
    @Autowired
    private BxInformalTjService bxInformalTjService;


    @RequestMapping("selectbxTJ")
    public ModelAndView selectbxTJ(Date startDate, Date endDate, String tjtype) {
        List<?> list = bxInformalTjService.typetj(startDate, endDate, tjtype);
        ModelAndView mv = new ModelAndView();
        mv.addObject("list", list);
        mv.addObject("startDate", startDate);
        mv.addObject("endDate", endDate);
        mv.addObject("tjtype", tjtype);
        mv.setViewName("../view/tongji/infortj.jsp");
        return mv;
    }

    @ResponseBody
    @RequestMapping("selecttypebing")
    public List<PieVo> selecttypebing(Date startDate, Date endDate, String tjtype) {
        List<PieVo> listbx = bxInformalTjService.tablebing(startDate, endDate, tjtype);
        if (listbx != null) {
            return listbx;
        }
        return null;
    }

    @ResponseBody
    @RequestMapping("selecttypezhu")
    public Map<String, Object> selecttypezhu(Date startDate, Date endDate, String tjtype) {
        Map<String, Object> map = bxInformalTjService.tablezhu(startDate, endDate, tjtype);
        return map;
    }


}
